package interfaces

import (
	"github.com/aws/constructs-go/constructs/v10"
	// "github.com/aws/jsii-runtime-go"
	"github.com/cdktf/cdktf-provider-aws-go/aws/v17/instance"
)

// EC2Config EC2 配置
type EC2Config struct {
	Name              string
	AmiID             string
	InstanceType      string
	KeyName           string
	SubnetID          string
	SecurityGroupIDs  []*string
	UserData          string
	Tags              map[string]string
	AssociatePublicIP bool
}

// EC2InstanceInfo EC2 实例信息
type EC2InstanceInfo struct {
	InstanceID string
	PublicIP   string
	PrivateIP  string
	State      string
	SubnetID   string
	VPCID      string
}

// EC2Creator EC2 创建接口
type EC2Creator interface {
	CreateEC2Instance(scope constructs.Construct, id string, config *EC2Config) (*instance.Instance, error)
	GetInstanceByID(scope constructs.Construct, instanceID string) (*instance.Instance, error)
	ListInstances() map[string]*instance.Instance
	GetInstancesBySubnet(subnetID string) map[string]*instance.Instance
	GetInstanceInfo(instance *instance.Instance) *EC2InstanceInfo
}

// EC2Selector EC2 选择器接口（用于查询和选择EC2）
type EC2Selector interface {
	GetInstancesByTags(tags map[string]string) map[string]*instance.Instance
	GetInstancesByVPC(vpcID string) map[string]*instance.Instance
	GetInstancesBySecurityGroup(sgID string) map[string]*instance.Instance
}
